#pragma once


#include <QtGui>
#include <iostream>
#include <windows.h> 
#include <process.h>
#include "CodeEditor.h"
#include "QDebugStream.h"

#include <process.h>


using namespace std;

class Console : public QPlainTextEdit
{
	Q_OBJECT

public:
	Console(QWidget *parent = 0);
	~Console(void);
	void interpret(QString s);

protected:
	void keyPressEvent(QKeyEvent *e);
	void mousePressEvent(QMouseEvent *e);
	void mouseDoubleClickEvent(QMouseEvent *e);
	void contextMenuEvent(QContextMenuEvent *e);

private:
	QString code;
	QString prompt;
	QStringList *history;
	int historyPos;
	enum PrintType { DEFAULT, CERROR };
	void init();
	void insertPrompt();
	void print(QString s, PrintType t = DEFAULT);
	void confirm();
	void test();
signals:
    void onConfirm();
    void onTerminate();
};
